/*******************************************************************************
 * Copyright 2011 @ Kapil Viren Ahuja
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.kapil.framework.reader;

import java.util.Locale;

/**
 * <p>
 * An interface that provides functions to read messages based a key from an underlying data source.
 * The interface also provides the method for implementations to read messages for a specific locale.
 * </p>
 * 
 * <p>
 * Once the {@link IMessageReader} has been created, there is no provision to add more datasources to the same.
 * </p>
 */
public interface IMessageReader
{
    /**
     * Reads a string message from the underlying data sources based on a <code>key</code>.
     * 
     * @param key a {@link String} representing unique identifier for the message.
     * 
     * @return {@link String} containing the message for the key passed
     */
    String getMessage(String key);


    /**
     * Reads a localised string message from the underlying data sources based on a <code>key</code>.
     * 
     * @param key a {@link String} representing unique identifier for the message.
     * @param locale a {@link String} representing the locale for which the message needs to be located.
     * 
     * @return {@link String} containing the message for the key passed
     */
    String getMessage(String key, Locale locale);
}
